﻿using Gsiot.Server;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

public class LedController
{
    public static void Main()
    {
        var ledActuator = new DigitalActuator
        {
            OutputPin = Pins.ONBOARD_LED
        };

        var webServer = new HttpServer
        {
            RelayDomain = "<insert your relay domain here>",
            RelaySecretKey = "<insert your secret key here>",
            RequestRouting =
            {
                {
                    "PUT /led/target",
                    new ManipulatedVariable
                    {
                        FromHttpRequest =
                            CSharpRepresentation.TryDeserializeBool,
                        ToActuator = ledActuator.HandlePut
                    }.HandleRequest
                }
            }
        };

        webServer.Run();
    }
}
